<%
//
// Copyright 2010-2013 Three Crickets LLC.
//
// The contents of this file are subject to the terms of the Apache License
// version 2.0: http://www.apache.org/licenses/LICENSE-2.0
// 
// Alternatively, you can obtain a royalty free commercial license with less
// limitations, transferable or non-transferable, directly from Three Crickets
// at http://threecrickets.com/
//

document.cacheDuration = 5000

var locale = conversation.query.get('locale') || application.globals.get('mongovision.locale') || 'en'

var theme = conversation.getCookie('ext-theme')
if (theme) {
	theme = decodeURIComponent(theme.value)
	if (theme.substring(0, 2) == 's:') { // Ext JS StateManager uses this to specify string type 
		theme = theme.substring(2)
	}
	else {
		theme = null
	}
}

var css = {
	gray: 'ext-theme-gray',
	blue: 'ext-theme-classic',
	access: 'ext-theme-access',
	neptune: 'ext-theme-neptune',
}

theme = conversation.query.get('theme') || theme || application.globals.get('mongovision.extJs.theme') || 'gray'

var debug = conversation.query.get('debug') || application.globals.get('mongovision.extJs.debug') || 'true'
if (debug.booleanValue) {
	debug = debug.booleanValue()
}
else if (typeof debug == 'string') {
	debug = debug == 'true'
}
%>
<html>
<head>
	<title>MongoVision</title>
	<link rel="shortcut icon" href="media/mongovision.ico" />
<% if (debug) { %>
	<!-- Ext JS Debug -->
	<link rel="stylesheet" type="text/css" href="style/ext-js/<%= css[theme] %>/<%= css[theme] %>-all-debug.css" id="ext-theme" />
	<script type="text/javascript" src="scripts/ext-js/ext-all-debug.js"></script>
<% } else { %>
	<!-- Ext JS -->
	<link rel="stylesheet" type="text/css" href="style/ext-js/<%= css[theme] %>/<%= css[theme] %>-all.css" id="ext-theme" />
	<script type="text/javascript" src="scripts/ext-js/ext-all.js"></script>
<% } %>
	<!-- MongoVision's Ext JS Extensions -->
	<script type="text/javascript" src="scripts/ux/HumanJSON.js"></script>
	<script type="text/javascript" src="scripts/ux/LoadMask.js"></script>
	<script type="text/javascript" src="scripts/ux/PerPage.js"></script>
	<script type="text/javascript" src="scripts/ux/TextFieldPopup.js"></script>
	<script type="text/javascript" src="scripts/ux/ThemeSwitcher.js"></script>

	<!-- Gritter Ext JS Extension (https://github.com/zir/ext-growl) -->
	<link rel="stylesheet" type="text/css" href="style/ux/gritter/css/ext-growl.css" />
	<script type="text/javascript" src="scripts/ux/ext-growl.js"></script>

	<!-- MongoVision -->
	<link rel="stylesheet" type="text/css" href="style/mongovision/mongovision.css" />
	<link rel="stylesheet" type="text/css" href="style/mongovision/<%= css[theme] %>/<%= css[theme] %>-all.css" id="mongovision-theme" />
	<script type="text/javascript" src="scripts/locale/<%= locale %>.js"></script>
	<script type="text/javascript" src="scripts/mongovision.js"></script>
<% if (debug) { %>
	<script type="text/javascript">
		Ext.onReady(function() {
			//Ext.log('MongoVision has been started in debug mode.');
		});
	</script>
<% } %>
</head>
<body id="body">
	<div id="header" class="x-hidden">
		<table width="100%"><tr>
			<td width="1%" align="left">
				<table height="100%"><tr>
					<td style="padding-right: 10px;">
						<img src="media/mongovision-small.png" />
					</td>
					<td>
						<h2 style="font-size: 14px;">MongoVision</h2>
						<a href="http://code.google.com/p/mongo-vision/">Community and Support Site</a><br />
						Version <%= application.globals.get('mongovision.version') %>
					</td>
				</tr></table>		
			</td>
			<td width="98%" id="header-main" align="right">
			</td>
			<td width="1%" align="right">
				<table height="100%"><tr>
					<td>
						Made with <a href="http://threecrickets.com/prudence/">Prudence</a><br />
						By <a href="http://threecrickets.com/">Three Crickets</a>
					</td>
					<td style="padding-left: 10px;">
						<a href="http://threecrickets.com/prudence/"><img src="media/prudence-small.png" /></a>
					</td>
				</tr></table>		
			</td>
		</tr></table>		
	</div>
</body>
</html>